PageSpinner Includes


Introduction to PageSpinner Includes

PageSpinner Includes gives you automatic inclusion of the current date or time and HTML text from files or NoteBook pages when saving a file in PageSpinner.

This is accomplished by a special HTML comment pair that works similar to a HTML tag - the major difference is that the comment pair is processed by PageSpinner when saving the file, and ignored by the browser when it renders the HTML file.

The contents between the start and end include comments can be automatically updated when you save the file in PageSpinner. By using this include feature you are able to maintain a consistent and easily editable look of several pages in a site.

In addition PageSpinner Includes enables you to automatically stamp the time and date when a page was last modified.



Case Study: Our Company

Below is a short story that illustrates how one can use PageSpinner Includes and how to design for easy site maintenance.

The Making of 'Our Company's' Site

1. First attempt
2. Second try
3. Final approach


1. First attempt

We have been given the mission to create a web site for a dubious company named Our Company and decided to accept it.

We start by creating a sample page that contains the elements we want in the page:

Since we want to be able to easily change these four parts, we creates PageSpinner include files for all parts except the contents. Inside the folder that should contain Our Company's pages we create a new folder that is named "Includes".

Inside the Include folder we create and save three include files named:

We copy the parts from the sample page we started out with. When saving an include file it is important to set it to be saved as Mac TEXT or ISO Latin-1 (not ISO 8859-1).

There is a script in the AppleScript menu named Save selection as Include, that can be used for this.

The header.incl contains the BODY tag so it will be easy to change the look of the pages. We start out with a nice green background color.

The file goto_contents.incl contains a link to the page that should contain the table of contents for the site.

Finally the file footer.incl has the text that should appear at the bottom of the page and the end BODY tag.

Now when the include files has been created we start making the actual pages of the site. In the sample page we just created, we delete the parts that was moved into include files and replace them with Include Comment Tags. These Include Comment are inserted into a file by using the Paste Include menu item available in PageSpinner's Edit menu.

In the Paste Include Dialog we select the include file, and paste the special comment pair tag where the file should be inserted. When this is done for all three include files we save the file with the name "contact.html". This page should contain information about how to contact Our Company. This is how the file looks like:

<HTML><HEAD><TITLE>Contact us!</TITLE></HEAD><!-- ps_include file="header.incl" --><!-- /ps_include file="header.incl" -->
<H1>Contact us!</H1>
<!-- ps_include file="goto_contents.incl" --><!-- /ps_include file="goto_contents.incl" -->
<!-- ps_include file="footer.incl" --><!-- /ps_include file="footer.incl" --></HTML>

In Finder we duplicate the contact.html file and renames the copies to:

In the page contents.html we also add an Include comment that displays the last time the page was saved. This Include comment tag looks like this and can also be inserted from the Paste Include dialog:

Last updated: <!-- ps_include date="short" --><!-- /ps_include -->

We add the actual contents to those four pages, and this is what the resulting pages looks like:

Pretty neat, we think while we walk over to Our Company to present their site.


2. Second try

OK, we have to admit it, they laughed at us when they saw the pages.

Maybe those colors wasn't so good after all. Our Company said that the contents were fine, but that they wanted a different, more cool but also respectable look.

So we give it a second try, and since we are using Include Files it is very easy to change all the pages. We just change the include files and then resave all the pages of the site, no need to edit each of them separately.

To open an Include file when we have an HTML file that has an Include Comment open in the editor we can select the name of the Include file and use the command Open Selection in PageSpinner's File menu.

We add the company's logo and change the color in the file header.incl, then add a new slogan in the file footer.incl.

In PageSpinner's AppleScript menu there is a script named Update Includes in Folder.... This script automatically updates all files, in a specific folder, that contains an include comment.

All the pages in the folder are now updated with the new look, and we haven't had to change anything in the actual files - we just edited two Include files.

This is what the resulting pages looks like, compare it to our first attempt:
First attempt Second try
contents.html contents.html
about.html about.html
products.html products.html
contact.html contact.html

Pretty neat, we think while we walk over to Our Company to present their site.


3. Final approach

This time they liked it better. There is just one problem with the table of contents, they wanted it to be easier to navigate on the site.

We change the include file, goto_contents.incl, that contains the link to the table of contents page from the old version to a new version and run the script named Update Include Files in Folder....

We can now also skip the entire contents page.

All the pages in the folder are now updated with the new look, and we haven't had to change anything in the actual files - we just edited one Include file.

This is what the resulting pages looks like, compare it to our Second try:
Second try Final approach
about.html about.html
products.html products.html
contact.html contact.html

Pretty neat, we think while we walk over to Our Company to present their site...


Summary

Hopefully you'll get the idea about how you could use PageSpinner's Includes to make site maintenance an easy chore.

If you already have an existing site there will be additional work involved: you need to decide which parts of the pages that should be in includes, create the include files and insert the Include comments. During this work you will find PageSpinner's keyboard shortcuts to Notebook pages 1 to 9 useful, since these enables you to manage multiple text snippets while working on several pages.

To find out more about how to utilize PageSpinner Includes, see the documentation that is available in the Index Page


Last updated: 6:20 PM , 6/2/97
© 1995-1997 Jerry ≈man.